#pragma once
#include "common.h"

typedef enum
{
    OP_NOP = 0,
    OP_ADD,
    OP_CBR, /* conditional branch */
    OP_JMP, /* jump */
    OP_MUL,
    OP_DIV,
    OP_LD,
    OP_ST,
    NUM_OP,
} OP_Code;

typedef struct
{
    word_t pc;

    OP_Code opcode;
    int8_t src[2];
    int8_t dst;

    bool mmio_access;
    word_t mem_access_addr;
    int8_t mem_access_size; /* Bytes */

    word_t branch_pc;
    bool branch_taken;
} Trace;

class OP
{
public:
    Trace trace;
    uint64_t id;
    bool valid;
};

void init_trace(std::string file_name);

OP *read_op();

void free_op(OP *op);